package com.cfuture08.home.action.perm;

import com.cfuture08.eweb4j.component.dwz.DWZUtil;
import com.cfuture08.eweb4j.mvc.action.ActionSupport;
import com.cfuture08.eweb4j.orm.dao.DAO;
import com.cfuture08.home.vo.Perm;

public class DeletePerm extends ActionSupport {
	private String ids;

	public String execute() {
		String[] idArray = ids.split(",");
		Perm[] perms = new Perm[idArray.length];
		for (int i = 0; i < perms.length; ++i) {
			perms[i] = new Perm();
			perms[i].setId(Integer.parseInt(idArray[i]));
		}

		out.print(DAO.delete(perms) == true ? DWZUtil.getSuccessJson("删除权限成功",
				"xssyqx", "showAllPerm.do", "reloadTab") : DWZUtil
				.getFailedJson("删除权限失败"));

		return AJAX;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}
}
